﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GM.Model;

namespace GM.Forms
{
    public partial class AssetForm : Form
    {
        private NewAssetForm m_newAssetForm;
        private AssetHistoryForm m_assetHistoryForm;
        private DeleteAssetForm m_deleteAssetForm;
        private MoveAssetForm m_moveAssetForm;

        public AssetForm()
        {
            InitializeComponent();

            m_newAssetForm = new NewAssetForm {Visible = false};
            m_assetHistoryForm = new AssetHistoryForm {Visible = false};
            m_deleteAssetForm = new DeleteAssetForm {Visible = false};
            m_moveAssetForm = new MoveAssetForm {Visible = false};
        }

        private void AssetForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            Hide();
        }

        private void olvAssets_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void AssetForm_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void LoadData()
        {
            
        }

        #region Menu

        private void tsmiHistory_Click(object sender, EventArgs e)
        {
            if(m_assetHistoryForm.Visible)
                m_assetHistoryForm.BringToFront();
            else
                m_assetHistoryForm.Show();
        }

        private void tsmiAddAsset_Click(object sender, EventArgs e)
        {
            if (m_newAssetForm.Visible)
                m_newAssetForm.BringToFront();
            else
                m_newAssetForm.Show();
        }

        private void tsmiMoveAsset_Click(object sender, EventArgs e)
        {
            if (m_moveAssetForm.Visible)
                m_moveAssetForm.BringToFront();
            else
                m_moveAssetForm.Show();
        }

        private void tsmiDeleteAsset_Click(object sender, EventArgs e)
        {
            if (m_deleteAssetForm.Visible)
                m_deleteAssetForm.BringToFront();
            else
                m_deleteAssetForm.Show();
        }
        #endregion
    }
}
